package com.ease.framework.gef4p.figures {
   import com.ease.framework.flex.controls.DottedLine;

   import flash.geom.Point;

   import mx.core.UIComponent;

   public class TempLaneUI extends UIComponent {
      private var l1:DottedLine = new DottedLine();
      private var l2:DottedLine = new DottedLine();
      private var l3:DottedLine = new DottedLine();
      private var l4:DottedLine = new DottedLine();
      private var l5:DottedLine = new DottedLine();

      private static var dash:Number = 15;
      private static var gap:Number = 15;

      public function TempLaneUI() {
         super();
         //this.width = 600;
         //this.height = 200;

         this.addChild(l1);
         this.addChild(l2);
         this.addChild(l3);
         this.addChild(l4);
         this.addChild(l5);

      }

      override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
         super.updateDisplayList(unscaledWidth, unscaledHeight);
         graphics.clear();

         recreateLine();

         graphics.lineStyle(1, 0x99C79B, 0);
         graphics.beginFill(0xB3D0C2, 0.4);
         graphics.drawRect(0, 0, this.width, this.height);
         graphics.endFill();

         graphics.lineStyle(6, 0x99C79B, 0.7);
         l1.draw(this.graphics);
         l2.draw(this.graphics);
         l3.draw(this.graphics);
         l4.draw(this.graphics);
         l5.draw(this.graphics);

      }

      protected function recreateLine():void {

         l1.spoint = new Point(0, 0);
         l1.epoint = new Point(this.width, 0);
         l1.dash = dash;
         l1.gap = gap;
         l1.preDraw();

         l2.spoint = new Point(this.width, 0);
         l2.epoint = new Point(this.width, this.height);
         l2.dash = dash;
         l2.gap = gap;
         l2.preDraw();

         l3.spoint = new Point(this.width, this.height);
         l3.epoint = new Point(0, this.height);
         l3.dash = dash;
         l3.gap = gap;
         l3.preDraw();

         l4.spoint = new Point(0, this.height);
         l4.epoint = new Point(0, 0);
         l4.dash = dash;
         l4.gap = gap;
         l4.preDraw();

         if (this.width > this.height) {
            l5.spoint = new Point(40, 0);
            l5.epoint = new Point(40, this.height);
         }
         else {
            l5.spoint = new Point(0, 40);
            l5.epoint = new Point(this.width, 40);
         }
         l5.dash = dash;
         l5.gap = gap;
         l5.preDraw();

      }
   }
}